BIN = pro
SRC = $(shell ls *.c)
OBJ = $(SRC:.c=.o)
CC = gcc 
RM = rm -f

$(BIN):$(OBJ)
	@$(CC) $^ -o $@
	@echo "链接 $^ 成 $@"

%.o:%.c
	@$(CC) -c $< -g
	@echo "编译... $< 成 $@"

.PHONY:clean
clean:
	@$(RM) $(OBJ) $(BIN)

.PHONY:test
test:
	@echo $(BIN)
	@echo $(SRC)
	@echo $(OBJ)




#$(BIN):$(OBJ)
#	$(CC) $(OBJ) -o $(BIN)
#$(OBJ):$(SRC)
#	$(CC) -c $(SRC) -o $(OBJ)
#.PHONY:clean
#clean:
#	$(RM) $(OBJ) $(BIN)



#mytest:test.o
#	gcc test.o -o mytest
#test.o:test.s
#	gcc -c test.s -o test.o
#test.s:test.i
#	gcc -S test.i -o test.s
#test.i:test.c
#	gcc -E test.c -o test.i


#.PHONY:mytest
#mytest:test.c
#	gcc test.c -o mytest
#
#.PHONY:clean
#clean:
#	rm -f mytest
